/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.lihle.designpatterns.app;

import com.lihle.designpatterns.model.behavioral.visitor.impl.ThreeElement;
import com.lihle.designpatterns.model.behavioral.visitor.impl.TotalSumVisitor;
import com.lihle.designpatterns.model.behavioral.visitor.NumberVisitor;
import com.lihle.designpatterns.model.behavioral.visitor.impl.TwoElement;
import com.lihle.designpatterns.model.behavioral.chainofresponsibility.EarthHandler;
import com.lihle.designpatterns.model.behavioral.chainofresponsibility.MercuryHandler;
import com.lihle.designpatterns.model.behavioral.chainofresponsibility.PlanetHandler;
import com.lihle.designpatterns.model.behavioral.chainofresponsibility.VenusHandler;
import com.lihle.designpatterns.model.behavioral.command.Command;
import com.lihle.designpatterns.model.behavioral.command.impl.Dinner;
import com.lihle.designpatterns.model.behavioral.command.impl.DinnerCommand;
import com.lihle.designpatterns.model.behavioral.command.impl.Lunch;
import com.lihle.designpatterns.model.behavioral.command.impl.LunchCommand;
import com.lihle.designpatterns.model.behavioral.command.impl.MealInvoker;
import com.lihle.designpatterns.model.behavioral.iterator.Item;
import com.lihle.designpatterns.model.behavioral.iterator.Menu;
import com.lihle.designpatterns.model.behavioral.mediator.AmericanSeller;
import com.lihle.designpatterns.model.behavioral.mediator.Buyer;
import com.lihle.designpatterns.model.behavioral.mediator.DollarConvertor;
import com.lihle.designpatterns.model.behavioral.mediator.FrenchBuyer;
import com.lihle.designpatterns.model.behavioral.mediator.Mediator;
import com.lihle.designpatterns.model.behavioral.mediator.SwedishBuyer;
import com.lihle.designpatterns.model.behavioral.memento.DietInfo;
import com.lihle.designpatterns.model.behavioral.memento.DietInfoCaretaker;
import com.lihle.designpatterns.model.behavioral.observer.impl.WeatherCustomer1;
import com.lihle.designpatterns.model.behavioral.observer.impl.WeatherCustomer2;
import com.lihle.designpatterns.model.behavioral.observer.impl.WeatherStation;
import com.lihle.designpatterns.model.behavioral.strategy.Strategy;
import com.lihle.designpatterns.model.behavioral.strategy.impl.Context;
import com.lihle.designpatterns.model.behavioral.strategy.impl.HikeStrategy;
import com.lihle.designpatterns.model.behavioral.strategy.impl.SkiStrategy;
import com.lihle.designpatterns.model.behavioral.templatemethod.CheeseBurgerMeal;
import com.lihle.designpatterns.model.behavioral.templatemethod.HamburgerMeal;
import com.lihle.designpatterns.model.behavioral.templatemethod.Meal;
import com.lihle.designpatterns.model.behavioral.visitor.impl.SumVisitor;
import com.lihle.designpatterns.model.creational.abstractfactory.AbstractFactory;
import com.lihle.designpatterns.model.creational.abstractfactory.MammalFactory;
import com.lihle.designpatterns.model.creational.abstractfactory.ReptileFactory;
import com.lihle.designpatterns.model.creational.abstractfactory.SpeciesFactory;
import com.lihle.designpatterns.model.creational.builder.MealBuilder;
import com.lihle.designpatterns.model.creational.builder.impl.ItalianMealBuilder;
import com.lihle.designpatterns.model.creational.builder.impl.JapaneseMealBuilder;
import com.lihle.designpatterns.model.creational.factorymethod.Animal;
import com.lihle.designpatterns.model.creational.factorymethod.Display;
import com.lihle.designpatterns.model.creational.factorymethod.impl.CSVFile;
import com.lihle.designpatterns.model.creational.factorymethod.impl.Cat;
import com.lihle.designpatterns.model.creational.factorymethod.impl.DBFile;
import com.lihle.designpatterns.model.creational.factorymethod.impl.Dog;
import com.lihle.designpatterns.model.creational.factorymethod.impl.XMLFile;
import com.lihle.designpatterns.model.creational.prototype.impl.Dogs;
import com.lihle.designpatterns.model.creational.prototype.impl.Person;
import com.lihle.designpatterns.model.creational.singleton.Singleton;
import com.lihle.designpatterns.model.stractural.adapter.TemperatureInfo;
import com.lihle.designpatterns.model.stractural.adapter.impl.TemperatureClassReporter;
import com.lihle.designpatterns.model.stractural.composite.impl.Composite;
import com.lihle.designpatterns.model.stractural.composite.impl.Leaf;
import com.lihle.designpatterns.model.stractural.facade.Facade;
import com.lihle.designpatterns.model.stractural.proxy.Proxy;
import com.lihle.designpatterns.model.stractural.proxy.impl.FastThing;

/**
 *
 * @author user
 */
public class AppFactory {

    public static Singleton getInst() {
        Singleton singletons = Singleton.getInstance();
        singletons.sayHello();
        return singletons;
    }

    public static Display getCSVFile() {
        Display d = new CSVFile();
        return d;
    }

    public static Display getXMLFile() {
        Display d = new XMLFile();
        return d;
    }

    public static Display getBDFile() {
        Display d = new DBFile();
        return d;

    }

    public static Animal getAnimalType(String type) {
        if ("canine".equals(type)) {
            return new Dog();
        } else {
            return new Cat();
        }
    }

    public static AbstractFactory getAbstractFactory(){
        AbstractFactory abstractFactory = new AbstractFactory();
        return abstractFactory;
    }

    public static MealBuilder italianMealBuilder() {
        MealBuilder mealB = new ItalianMealBuilder();
        return mealB;
    }

    public static MealBuilder japaneseMealBuilder() {
        MealBuilder mealB = new JapaneseMealBuilder();
        return mealB;
    }

    public static Person getPerson() {
        Person person = new Person("Fred");
        return person;
    }

    public static Dogs getDog() {
        Dogs dog = new Dogs("Woof!");
        return dog;
    }

    public static void testInfo(TemperatureInfo tempInfo) {
        tempInfo.setTemperatureInc(0);
        System.out.println("temp in C: " + tempInfo.getTemperatureInc());
        System.out.println("temp in F: " + tempInfo.getTemperatureInf());

        tempInfo.setTemperatureInf(85);
        System.out.println("temp in C: " + tempInfo.getTemperatureInc());
        System.out.println("temp in F: " + tempInfo.getTemperatureInf());

    }

    public static TemperatureInfo getTempInfo() {
        TemperatureInfo tempInfo = new TemperatureClassReporter();
        return tempInfo;
    }

    public static Leaf giveName() {
        Leaf leaf = new Leaf();
        leaf.setName("Pop");
        return leaf;
    }

    public static Composite getComposite() {
        Composite comp = new Composite();
        return comp;
    }

    public static Proxy getProxy() {
        Proxy proxy = new Proxy();
        return proxy;
    }

    public static FastThing getFastThing() {
        FastThing f = new FastThing();
        return f;
    }

    public static Facade getFacade() {
        Facade facade = new Facade();
        return facade;
    }

    public static Meal getHamburgerMeal() {
        Meal meal = new HamburgerMeal();
        return meal;
    }

    public static Meal getCheeseburgerMeal() {
        Meal meal = new CheeseBurgerMeal();
        return meal;
    }

    public static Mediator getMediator() {
        Mediator m = new Mediator();
        return m;
    }

    public static Buyer getSwedishBuyer(Mediator mediator) {
        Buyer c = new SwedishBuyer(mediator);
        return c;
    }

    public static Buyer getFrenchBuyer(Mediator mediator) {
        Buyer b = new FrenchBuyer(mediator);
        return b;
    }

    public static AmericanSeller getAmericanSellar(Mediator m, float b) {
        AmericanSeller n = new AmericanSeller(m, b);
        return n;
    }

    public static DollarConvertor getDollarConvertor(Mediator mediator) {
        DollarConvertor d = new DollarConvertor(mediator);
        return d;
    }

    public static PlanetHandler setUpChain() {

        PlanetHandler mercuryHandler = new MercuryHandler();
        PlanetHandler venusHandler = new VenusHandler();
        PlanetHandler earthHandler = new EarthHandler();

        mercuryHandler.setSuccessor(venusHandler);
        venusHandler.setSuccessor(earthHandler);

        return mercuryHandler;
    }

    public static WeatherStation getWeatherStation() {
        WeatherStation w = new WeatherStation(33);
        return w;
    }

    public static WeatherCustomer1 getCostomer1() {
        WeatherCustomer1 cust1 = new WeatherCustomer1();
        return cust1;
    }

    public static WeatherCustomer2 getCostomer2() {
        WeatherCustomer2 cust2 = new WeatherCustomer2();
        return cust2;
    }

    public static Strategy getSkiStrategy() {
        Strategy sst = new SkiStrategy();
        return sst;
    }

    public static Strategy getHikeStrategy() {
        Strategy hst = new HikeStrategy();
        return hst;
    }

    public static Context getContext(int temperatureInF, Strategy skiStrategy) {
        temperatureInF = 60;
        Context context = new Context(temperatureInF, skiStrategy);
        return context;
    }

    public static Lunch getLunch() {
        Lunch l = new Lunch();
        return l;
    }

    public static Command getLunchCommand(Lunch lunch) {
        Command lunchCommand = new LunchCommand(lunch);//concrete command
        return lunchCommand;
    }

    public static Command getDinnerCommand(Dinner dinner) {
        Command dinnerCommand = new DinnerCommand(dinner);//concrete command
        return dinnerCommand;
    }

    public static Dinner getDinner() {
        Dinner d = new Dinner();
        return d;
    }

    public static MealInvoker getMealInvoke(Command lunchCommand) {
        MealInvoker mealInvoker = new MealInvoker(lunchCommand);
        return mealInvoker;
    }

    public static TwoElement get2Element(int a, int b) {
        TwoElement n = new TwoElement(a, b);
        return n;
    }

    public static ThreeElement get3Element(int a, int b, int c) {
        ThreeElement n = new ThreeElement(a, b, c);
        return n;
    }

    public static NumberVisitor getNumberVisitor() {

        NumberVisitor numberVisitor = new SumVisitor();
        return numberVisitor;
    }

    public static TotalSumVisitor getTotalSuVisitor() {

        TotalSumVisitor totalSumVisitor = new TotalSumVisitor();
        return totalSumVisitor;
    }
    
    public static Item getItems(String s, float f) {
        Item item = new Item(s, f);
        return item;
    }

    public static Menu getMenu() {
        Menu m = new Menu();
        return m;
    }
    
     public static DietInfoCaretaker getDietInfoCaretaker() {
        DietInfoCaretaker d = new DietInfoCaretaker();
        return d;
    }

    public static DietInfo getDietInfo(String s, int n, int w) {
        DietInfo d = new DietInfo(s, n, w);
        return d;
    }
}
